package com.wulian.service.impl;

import com.github.pagehelper.PageInfo;
import com.wulian.dao.PatientDao;
import com.wulian.entities.Patient;
import com.wulian.service.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xf
 * @date 2021/3/20 下午 2:49
 * @Description
 */
@Service
public class PatientServiceImpl implements PatientService {

    @Autowired
    private PatientDao patientDao;

    @Override
    public List<Patient> getAll() {
        return patientDao.getAll();
    }

    @Override
    public PageInfo<Patient> getAllByPage(Integer pageNum, Integer size) {
        List<Patient> list = patientDao.getAllByPage(pageNum, size);
        PageInfo<Patient> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public Patient getPatientById(Long id) {
        return patientDao.getPatientById(id);
    }

    @Override
    public void addPatient(Patient patient) {
        patientDao.addPatient(patient);
    }

    @Override
    public void updatePatient(Patient patient) {
        patientDao.updatePatient(patient);
    }

    @Override
    public void deletePatientById(Long id) {
        patientDao.deletePatientById(id);
    }
}
